function onlyNum(){
    if(!(event.keyCode==46)&&!(event.keyCode==8)&&!(event.keyCode==37)&&!(event.keyCode==39))
        if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)))
            event.returnValue=false;  //执行至该语句时，阻止输入；可类比阻止冒泡原理或者禁止右键功能；
}

/*

var fileCode_maxstrlen = 4;

function getStrleng(str, maxstrlen) {
    var myLen = 0;
    i = 0;
    for (; (i < str.length) && (myLen <= maxstrlen * 2); i++) {
        /!*if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128)
            myLen += 1;
        else*!/
        myLen += 2;
    }
    return myLen;
}

function checkFileCodeLen(c) {
    var len = fileCode_maxstrlen;
    var str = c.value;
    var myLen = getStrleng(str, len);

    if (myLen > len * 2) {
        //  /^\s+|\s+$/g 校验字符串的
        // /^\d{1,11}$/ 校验数字的
        c.value = str.replace(/^\d{1,11}$/,"").substring(0, i + 1);
    }
    else {
        c.value = str.replace(/^\d{1,11}$/,"");
    }
}
*/
